AMP files are WindThunder’s transparent PCX format used in Heroine Anthem I&II. Their extension is usually .AMP, .000 or .001.
Rather than specify a mask bit, a second, monochrome PCX file is stored after the full-color image.
In theory, this format will work with other image formats besides PCX, but I do not believe it is used in the games with any other format.
Every AMP file begins with a 30 byte header. Offsets are stored in little endian ordering, and strings are padded with 0×00:
ID Tag: 'AMP_FILE V1.0' [14 bytes, string]
Image width [4 bytes, long]
Image height [4 bytes, long]
File size [4 bytes, long]
Mask size [4 bytes, long]
(data)
Immediately following the header is the first graphic. The second graphic [mask] begins at (File size + 30) and continues until the end of the file.
Proof of method code is included below:
$filename = 'CatchPointFont.000';
$fd = fopen($filename, 'rb');
if(rtrim(fread($fd, 14)) != "AMP_FILE V1.0") die;
$imgwidth = unpack('V*', fread($fd, 4));
$imgheight = unpack('V*', fread($fd, 4));
$filesize = unpack('V*', fread($fd, 4));
$masksize = unpack('V*', fread($fd, 4));
$fo = fopen($filename.'.image', "w");
fputs($fo, fread($fd, $filesize));
fclose($fo);
$fo = fopen($filename.'.mask', "w");
fputs($fo, fread($fd, $masksize));
fclose($fo);
fclose($fd);